//
// Created by A4-28 on 2020/10/14.
//
#include "quaternion.h"
#include <iostream>
#include "glm/gtx/euler_angles.hpp"
#include "glm/gtx/quaternion.hpp"

static const float DegreeToRadian = M_PI / 360.0f;
static const float RadianToDegree = 1.0f / DegreeToRadian;

int main() {

    glm::quat quat = WF::Quaternion::EulerToQuaternion(glm::vec3(0, 0, 66));
    std::cout << quat.w << "," << quat.x << "," << quat.y << "," << quat.z << std::endl;

    glm::vec3 euler = WF::Quaternion::QuaternionToEuler(quat);
    std::cout << euler.x << "," << euler.y << "," << euler.z << std::endl;

    std::cout << "------------" << std::endl;

//    glm::quat quat1 = glm::angleAxis(90.0f , glm::vec3(1, 0, 0));
//    std::cout << quat1.w << "," << quat1.x << "," << quat1.y << "," << quat1.z << std::endl;

    //四元数转欧拉角


    glm::mat4 ma = glm::eulerAngleYXZ<float>(0 , 0, 66* DegreeToRadian);
    glm::quat qa = glm::toQuat(ma);
    std::cout << qa.w << "," << qa.x << "," << qa.y << "," << qa.z << std::endl;

//    glm::quat qq = glm::angleAxis(180.0f * DegreeToRadian,glm::vec3(1,0,0));
//    std::cout << qq.w << "," << qq.x << "," << qq.y << "," << qq.z << std::endl;

    glm::vec3 cc=glm::eulerAngles(qa);
    std::cout<<cc.x*RadianToDegree<<","<<cc.y*RadianToDegree<<","<<cc.z*RadianToDegree<<std::endl;
}
